Character Def

The "Character Def" file creates most aspects of a player character to be used in the game. Character sprites, movement properties, sound effect IDs, and animations are listed here. There are a set number of player "Constants" that must be used in a particular order. The same applies to sound effects, and Animation functions. Custom data may be added to the end of lists whose size is available in the current Character Def or the "Game Def" script for changing. It is recommended that if the Characters have art that is used for status displays, that it be placed at the beginning of the sprite listing, so that it will have the same Sprite ID for every Character included in the game. Sprites may otherwise be listed in any order. If the sprite listing is modified at any time, Animations and status displays may need to be updated to reflect the changes if frames were inserted or deleted.

Format Description



Example Character Def
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Example Character Def File ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Sprite File: chr0.spr


;-----------------------------------------------------------------;
;----------------Character's Constant Properties------------------;
;-----------------------------------------------------------------;
;Total number is defined in Game Def File

;The 9 Required Constants
  0 - Player_InitFunc:                    22 ;Common Func 22, Player Init/Sentry

  1 - Player_VPScroll_Left:              144
  2 - Player_VPScroll_Right:             160
  3 - Player_VPScroll_Up:                 96
  4 - Player_VPScroll_Down:               96
  5 - Player_VPX_Speed:                   16
  6 - Player_VPY_Speed:                   16

  7 - Player_SlopeTolerance_Floor:         4
  8 - Player_SlopeTolerance_Ceiling:       4

;The extra Constants just for this game
  0 - Example User Constant 0:          $600
  1 - Example User Constant 1:            $C


;-----------------------------------------------------------------;
;-----------------Character's Custom Variables--------------------;
;-----------------------------------------------------------------;
;These are just comments to document the custom variables used in scripts

; 0 - Example Custom Player Variable 0
; 1 - Example Custom Player Variable 1


;-----------------------------------------------------------------;
;-------------------Character's Sound Effects---------------------;
;-----------------------------------------------------------------;

;The 0 Required sounds
  ;There are currently no required sounds

;The extra sounds just for this game
Number of Custom Sound Effects:   2
  0 - Example Chr SFX 0:     1
  1 - Example Chr SFX 1:     2


;-----------------------------------------------------------------;
;--------------------Movement Mode Properties---------------------;
;-----------------------------------------------------------------;

Number of Movement Modes:   2

Mode 0 - Example Movement Mode 0
        Movement Function:C11  ;Character Common Function 11
          Update Function:C12  ;Character Common Function 12
     Number of Key Events:  2
    Event 0 - Num of Keys:  1  ;Example Player Key Event
                    Key 1:PH0  ;Hold Player Button 0
                 Function:C25  ;Character Common Function 25
    Event 1 - Num of Keys:  1  ;Example Player Key Event
                    Key 1:PT1  ;Tap Player Button 1
                 Function:C26  ;Character Common Function 26
Mode 1 - Example Movement Mode 1
        Movement Function:C13  ;Character Common Function 13
          Update Function:C14  ;Character Common Function 14
     Number of Key Events:  2
    Event 0 - Num of Keys:  1  ;Example Player Key Event
                    Key 1:PH0  ;Hold Player Button 0
                 Function:  2  ;This Character's Function 2
    Event 1 - Num of Keys:  1  ;Example Player Key Event
                    Key 1:PT1  ;Tap Player Button 1
                 Function:  3  ;This Character's Function 3


;-----------------------------------------------------------------;
;-------------------Animation Function Listing--------------------;
;-----------------------------------------------------------------;

;The 1 Required Animations
  0 - Default Animation:                 1 ; Used by this script for standing still

;The extra Animations just for this game
Number of Custom Animation Entries:    25

  1 - Example Custom Animation 1:        7 ;  l0	(This Character Function  7)
  2 - Example Custom Animation 1:       11 ;  l1	(This Character Function 11)
  3 - Example Custom Animation 1:        7 ;  l2	(This Character Function  7)


;-----------------------------------------------------------------;
;-----------Character's Animation and Action Functions------------;
;-----------------------------------------------------------------;

Number of Player Funcs: 2

;===================================================================================
;=======================================
;Function 0 - Example Player Function 0=
;=======================================

	#_FetchPlayer				
	:_Ref_All						
	:r_Curr_Player						

	#_Chr=Const				;Set the player's flags
	:A_Player_Flags						;(Chr2)
	:%11101011100						;(Const) Left/Right stop, VPCenter, FollowPath, UseVector, FollowCurves, RotateBounds

# End	;Terminate Function

;===================================================================================
;=======================================
;Function 1 - Example Player Function 1=
;=======================================
@0
	#_FetchPlayer				
	:_Ref_All						
	:r_Curr_Player						

	#_Chr++					;Move one pixel
	:A_Player_X_Pos						

	#_FuncBreak				;Break until next frame
	#_GoTo					;Re-run the function
	:  @0

# End	;Terminate Function